home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Views / NumeralView.cp < prev    next >
Text File  |  1997-06-28  |  534b  |  33 lines

  1. // NumeralView.cp
  2.  
  3. #ifndef NumeralView_h
  4. #include "NumeralView.h"
  5. #endif
  6.  
  7. NumeralView::NumeralView( ::Face face )
  8.   : StringView( face ),
  9.      digits( 11 )
  10.   {
  11.   }
  12.  
  13. void NumeralView::SetNumber( int32 n )
  14.   {
  15.     String255 numeral;
  16.     NumToString( n, numeral );
  17.     SetString( numeral );
  18.   }
  19.  
  20. uint16 NumeralView::MinimumWidth() const
  21.   {
  22.     String255 string;
  23.     string.SetLength( digits );
  24.     for ( uint32 i = 0; i < digits; i++ )
  25.         string[i] = '0';
  26.     return WidthOf( string );
  27.   }
  28.  
  29. uint16 NumeralView::BestWidth() const
  30.   {
  31.     return MinimumWidth();
  32.   }
  33.